#include"QuickSort.h"


int main()
{
	//数组B的长度小于10，测试快速排序的程序是否正确
	vector<int>B;
	B.push_back(4);
	B.push_back(1);
	B.push_back(2);
	B.push_back(5);
	B.push_back(5);
	B.push_back(3);
	vector<int>D = B;//拷贝B到D
	cout << "随机选择主元策略的测试输出:" << endl;
	cout << "数组B的起始为：" << endl;
	for (unsigned int i = 0; i < B.size(); i++) {
		std::cout << B[i] << " ";
	};
	cout << endl;
	sort1(B);
	cout << "对数组B快速排序后B的序列为：" << endl;
	for (unsigned int i = 0; i < B.size(); i++) {
		std::cout << B[i] << " ";
	};
	cout << endl;

	//数组A的长度大于10，测试快排的程序是否正确
	vector<int>A;
	A.push_back(12);
	A.push_back(11);
	A.push_back(16);
	A.push_back(43);
	A.push_back(7);
	A.push_back(7);
	A.push_back(39);
	A.push_back(24);
	A.push_back(3);
	A.push_back(20);
	A.push_back(81);
	A.push_back(30);
	vector<int>C = A;//拷贝A到C
	cout << "数组A的起始为：" << endl;
	for (unsigned int i = 0; i < A.size(); i++) {
		std::cout << A[i] << " ";
	};
	cout << endl;
	sort1(A);
	cout << "对数组A快速排序后A的序列为：" << endl;
	for (unsigned int i = 0; i < A.size(); i++) {
		std::cout << A[i] << " ";
	};
	cout << endl;
	cout << "-----------------------------------------" << endl;
	cout << "median-of-three策略选择主元的测试输出：" << endl;
	cout << "数组D的起始为：" << endl;
	for (unsigned int i = 0; i < D.size(); i++) {
		std::cout << D[i] << " ";
	};
	cout << endl;
	sort(D);
	cout << "对数组D快速排序后D的序列为：" << endl;
	for (unsigned int i = 0; i < D.size(); i++) {
		std::cout << D[i] << " ";
	};
	cout << endl;
	cout << "数组C的起始为：" << endl;
	for (unsigned int i = 0; i < C.size(); i++) {
		std::cout << C[i] << " ";
	};
	cout << endl;
	sort(C);
	cout << "对数组C快速排序后C的序列为："<<endl;
	for (unsigned int i = 0; i < C.size(); i++) {
		std::cout << C[i] << " ";
	};
	cout << endl;

}